package demo2;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.TimerTask;
import java.util.concurrent.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-08-07
 * Time: 10:41
 */
public class TestDemo {

    public static void main1(String[] args) throws ExecutionException, InterruptedException {
        Callable<Integer> callable = new Callable<Integer>() {
            @Override
            public Integer call() throws Exception{
                int sum =0;
                 for(int i =0;i<=1000;++i){
                     sum+=i;
                 }
                 return sum;
            }
        };
        FutureTask<Integer>  futureTask = new FutureTask<>(callable);
        Thread t = new Thread(futureTask);
        t.start();
        System.out.println(futureTask.get());
    }

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        executorService.submit(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello,world");
            }
        });
        Queue<Integer> queu = new LinkedList<>();
        queu.offer(1);
        LinkedList<Integer> list = new LinkedList<>();
        list.removeLast();
    }


}
